# flask 扩展工具类
from flask import url_for, request, redirect


#  适配 https 转发
def my_redirect(location, req: request = None, code=302, Response=None):
    if (request is not None) and req.url.startswith('https://'):
        return redirect(url_for(location, _external=True, _scheme='https'), code, Response)
    else:
        return redirect(url_for(location), code, Response)
